package com.jming.yygh.hosp.controller;

import com.jming.yygh.common.result.Result;
import com.jming.yygh.hosp.service.DepartmentService;
import com.jming.yygh.vo.hosp.DepartmentVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author jming
 * @version 0.0.1
 * @date 2021/05/05
 */
@Api(tags = "科室管理接口")
//@CrossOrigin  // 允许跨域访问
@RestController   // Rest风格注入
@RequestMapping("/admin/hosp/department")
public class DepartmentController {

    @Resource
    private DepartmentService departmentService;

    /**
     * 根据医院标号查询医院所有科室信息
     * @param hoscode 医院编号
     * @return Result
     */
    @ApiOperation(value = "查询医院所有科室列表")
    @GetMapping("getDeptList/{hoscode}")
    public Result getDeptList(@PathVariable String hoscode) {

        List<DepartmentVo> list = departmentService.findDeptTree(hoscode);

        return Result.ok(list);
    }

}
